package com.medicine.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.springframework.aop.ThrowsAdvice;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import exception.YpkcxxNotFind;
import exception.ZgxxNotFind;
import pagination.Page;
import po.Rkxx;
import po.Ypkcxx;
import po.Ypxx;
import po.Zgxx;
import requestvo.AbandonReqVo;
import requestvo.RkxxReqVo;
import requestvo.YpkcxxReqVo;

@Service
public class RepairService extends BaseServiceImpl{
	
	public Page findsbbfxx(AbandonReqVo abandonReqVo){
		Page<AbandonReqVo> page=new Page<>();
		if (abandonReqVo.getSb_no() != null&&!abandonReqVo.getSb_no().equals("")){
			page.getParams().put("sb_no", abandonReqVo.getSb_no());
		}
		if (abandonReqVo.getSb_name() != null&&!abandonReqVo.getSb_name().equals("")){
			page.getParams().put("sb_name", abandonReqVo.getSb_name());
		}	
		if(abandonReqVo.getGly_name()!=null&&!abandonReqVo.getGly_name().equals("")) {
			page.getParams().put("gly_name", abandonReqVo.getGly_name());
		}		
		if(abandonReqVo.getSys_name()!=null&&!abandonReqVo.getSys_name().equals("")) {
			page.getParams().put("sys_name", "%"+abandonReqVo.getSys_name()+"%");
		}
		if(abandonReqVo.getCount()!=null&&!abandonReqVo.getCount().equals("")){
			page.getParams().put("count", abandonReqVo.getCount());
		}
		if(abandonReqVo.getAbandontime()!=null&&!abandonReqVo.getAbandontime().equals("")){
			page.getParams().put("abandontime", abandonReqVo.getAbandontime());
		}
		if(abandonReqVo.getAbandontime1()!=null&&!abandonReqVo.getAbandontime1().equals("")){
			page.getParams().put("abandontime1", abandonReqVo.getAbandontime1());
		}
		if(abandonReqVo.getAbandontime2()!=null&&!abandonReqVo.getAbandontime2().equals("")){
			page.getParams().put("abandontime2", abandonReqVo.getAbandontime2());
		}
		page.setPageNo(abandonReqVo.getPage());
		page.setPageSize(abandonReqVo.getRows());
		page.setResults(abandonDao.findPage(page));
		return page;
	}

	public void updatesbbfxx(AbandonReqVo abandonReqVo) {
		// TODO Auto-generated method stub
		abandonDao.update(abandonReqVo);
		
	}
	
	public void addsbbfxx(AbandonReqVo abandonReqVo) {
		// TODO Auto-generated method stub
		abandonDao.insert(abandonReqVo);
		/*Ypkcxx	ypkcxx  = ypkcxxDao.get(abandonReqVo.getyPBM());
		if(ypkcxx==null){
			throw new YpkcxxNotFind(rkxx.getyPBM());		
		}
		else{
			Zgxx zgxx=zgxxDao.get(rkxx.getzGBM());
			if(zgxx==null) throw new ZgxxNotFind(rkxx.getzGBM());
			ypkcxx.setyPSL(ypkcxx.getyPSL()+rkxx.getrKL());
			abandonDao.update(ypkcxx);
		}*/
	}
	public void delsbbfxx(Integer[] integers) {
		// TODO Auto-generated method stub
		abandonDao.delete(integers);
	}

}
